import { _decorator, Component, Node, NodeEventType } from 'cc';
import { loadPool } from '../res/loadPool';
const { ccclass, property } = _decorator;
const tt = window['tt'];
@ccclass('cebianPopTs')
export class cebianPopTs extends Component {
    // 侧边栏按钮
    @property(Node)
    private cebian: Node;
    // 关闭弹窗按钮
    @property(Node)
    private close: Node;
    start() {
        // 侧边栏按钮事件
        this.cebian.on(NodeEventType.TOUCH_START, this.cebianBtn, this)
        // 关闭弹窗事件
        this.close.on(NodeEventType.TOUCH_START, this.closeBtn, this)
    }

    // 点击自动跳转到侧边栏
    cebianBtn() {
        loadPool.ins.huiShouNode(this.node)
        tt.navigateToScene({
            scene: 'sidebar',
            success: (res) => {
                console.log("check scene success: ", res);
            },
            fail: (res) => {
                console.log("check scene fail:", res);
            }
        })
    }

    // 关闭按钮
    closeBtn() {
        loadPool.ins.huiShouNode(this.node)
    }
}


